using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Viettel.VOFFICE.DAO.Models.Mapping
{
    public class vw_aspnet_DepartmentInRolesMap : EntityTypeConfiguration<vw_aspnet_DepartmentInRoles>
    {
        public vw_aspnet_DepartmentInRolesMap()
        {
            // Primary Key
            this.HasKey(t => new { t.RoleId, t.RoleName, t.LoweredRoleName, t.DepartmentId });

            // Properties
            this.Property(t => t.RoleName)
                .IsRequired()
                .HasMaxLength(256);

            this.Property(t => t.LoweredRoleName)
                .IsRequired()
                .HasMaxLength(256);

            this.Property(t => t.RoleDisplayName)
                .HasMaxLength(255);

            this.Property(t => t.DepartmentName)
                .HasMaxLength(100);

            this.Property(t => t.DepartmentId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("vw_aspnet_DepartmentInRoles");
            this.Property(t => t.RoleId).HasColumnName("RoleId");
            this.Property(t => t.RoleName).HasColumnName("RoleName");
            this.Property(t => t.LoweredRoleName).HasColumnName("LoweredRoleName");
            this.Property(t => t.RoleDisplayName).HasColumnName("RoleDisplayName");
            this.Property(t => t.DepartmentName).HasColumnName("DepartmentName");
            this.Property(t => t.DepartmentId).HasColumnName("DepartmentId");
        }
    }
}
